﻿using System.Collections.Generic;
using Engine;
using Engine.Graphics;
using Game;

namespace Mekiasm.Plants
{
    public class MatureCropItems : ItemFlat
    {
        public MatureCropItems(string disName, string textureName) : base(disName, ContentManager.Get<Texture2D>("Mekiasm/Textures/MatureItems/" + textureName))
        {
        }
        public override int GetTextureSlotCount(int value)
        {
            return 1;
        }
        public override void GenerateTerrainVertices(Block block, BlockGeometryGenerator generator, TerrainGeometry geometry, int value, int x, int y, int z)
        {
            generator.GenerateCrossfaceVertices(block, value, x, y, z, Color.White, 0, geometry.GetGeometry(texture2D).SubsetAlphaTest);
        }
        public override bool IsFaceTransparent(SubsystemTerrain subsystemTerrain, int face, int value)
        {
            return true;
        }
        public override bool OnUse(Ray3 aim, ComponentMiner componentMiner, TerrainRaycastResult? raycast)
        {
            return true;
        }
        public override void GetDropValues(SubsystemTerrain subsystemTerrain, int oldValue, int newValue, int toolLevel, List<BlockDropValue> dropValues, out bool showDebris)
        {
            showDebris = true;
            dropValues.Add(new BlockDropValue() { Value = ILibrary.GetBasicValue(oldValue), Count = ILibrary.random.Int(2, 4) });
        }
        public override float GetNutritionalValue()
        {
            return 0.05f;
        }
        
        public override BoundingBox[] GetCustomCollisionBoxes(SubsystemTerrain terrain, MovingBlock value)
        {
            return new BoundingBox[0];
        }

        public override bool IsFood()
        {
            return true;
        }
        public override BlockDigMethod GetDigMethod(int value)
        {
            return BlockDigMethod.Hack;
        }
        public override float GetDigResilience(int value)
        {
            return 0f;
        }
    }
}
